#ifndef OCK_MEMORY_BRIDGE_OCK_ADAPTER_TASK_SYNC_UTILS_H
#define OCK_MEMORY_BRIDGE_OCK_ADAPTER_TASK_SYNC_UTILS_H
#include <functional>
#include "ock/acladapter/task/OckAsyncTaskExt.h"
#include "ock/acladapter/executor/OckAsyncTaskExecuteService.h"
#include "ock/acladapter/utils/OckAdapterMemoryGuard.h"
namespace ock {
namespace acladapter {

class OckSyncUtils
{
public:
    virtual ~OckSyncUtils() noexcept = default;
    explicit OckSyncUtils(OckAsyncTaskExecuteService &service);

    OckAsyncTaskExecuteService &GetService(void);
    std::pair<hmm::OckHmmErrorCode, std::unique_ptr<OOckAdapterMemoryGuardck>> Malloc(
        size_t byteSize, hmm::OckHmmHeteroMemoryLocation location, uint32_t timeout = 0);
    hmm::OckHmmErrorCode Free(void *addr, hmm::OckHmmHeteroMemoryLocation location, uint32_t timeout = 0);
    hmm::OckHmmErrorCode Copy(
        void *dst, size_t destMax, const void *src, size_t count, OckMemoryCopyKind kind, uint32_t timeout = 0);
    hmm::OckHmmErrorCode CreateStream(OckDevRTStream &stream);
    hmm::OckHmmErrorCode DestroyStream(OckDevRTStream &stream); 
    hmm::OckHmmErrorCode SynchronizeStream(OckDevRTStream stream, uint32_t timeout = 0);
    hmm::OckHmmErrorCode ExecFun(
        OckTaskResourceType resourceType,std::function<hmm::OckHmmErrorCode()>opFun, uint32_t timeout = 0);
    std::shared_ptr<OckAsyncResultInnerBridge<OckDefautResult>> ExecFunAsync(
        OckTaskResourceType resourceType,std::function<hmm::OckHmmErrorCode()>opFun);
private:
    OckAsyncTaskExecuteService &service;
};
std::ostream &operator<<(std::ostream &os, const OckAdapterMemoryGuard &data);

}
}
#endif